package cn.edu.javaweb.userServlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.javaweb.javabean.UserForumQuestion;
import cn.edu.javaweb.service.UserForumQuestionService;



@WebServlet("/ForumQuestionServlet")
public class ForumQuestionServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private UserForumQuestionService questionService = new UserForumQuestionService();
    
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<UserForumQuestion> questionlist = questionService.getQuestions();
		request.setAttribute("question",questionlist);
        RequestDispatcher rd=request.getRequestDispatcher("volunteer/user/ForumQuestion.jsp");
	    rd.forward(request, response);
	}
}
